# -*- coding: utf-8 -*-
"""
多语言演示模块
"""
from flask import Flask,Blueprint, render_template, request, session, redirect, url_for
# 多语言蓝图
i18n_bp = Blueprint('i18n',
                        __name__, 
                        url_prefix='/i18n')
def register_i18n_bps(app: Flask):
    app.register_blueprint(i18n_bp)

@i18n_bp.route('/switch/<lang>')
def switch_language(lang):
    """切换语言"""
    session['lang'] = lang
    return redirect(request.referrer or url_for('index'))
